import { DepthTexture, Mapping, mappingValues, TextureDataType, textureDataTypeValues, TextureFilter, textureFilterValues, Wrapping, wrappingValues } from "../../thirdparty/three/imports";
import { Texture3D } from "./Texture3D";

export interface DepthTexture3D
{
    /**
     * @private
     */
    get _texture(): DepthTexture;
    set _texture(v);

    /**
     * @private
     */
    __texture: DepthTexture;
}

export class DepthTexture3D extends Texture3D
{
    constructor(width?: number, height?: number, type?: TextureDataType, mapping?: Mapping, wrapS?: Wrapping, wrapT?: Wrapping, magFilter?: TextureFilter, minFilter?: TextureFilter, anisotropy?: number)
    {
        super();
        this._texture = new DepthTexture(width, height, textureDataTypeValues[type], mappingValues[mapping], wrappingValues[wrapS], wrappingValues[wrapT], textureFilterValues[magFilter], textureFilterValues[minFilter], anisotropy);
    }

    static get(texture: DepthTexture): DepthTexture3D
    {
        let texture3D = this._map.get(texture) as DepthTexture3D;
        if (!texture3D)
        {
            texture3D = new DepthTexture3D();
            texture3D._texture = texture;
        }

        return texture3D;
    }
}
